<?php
/*
 * author: wiloke-pirates
 * author uri: wiloke.com
 * date: 04/24/2014
 * time: 03 AM
 */




require_once('config/wiloke.define.php');
require_once('config/wiloke.theme-supports.php');
require_once(QVA_DEFS . 'defaults-config.php');
require_once(QVA_ADMIN_DIR . '/class.wiloke.php');
require_once(QVA_ADMIN_MD . '/widgets/class.widget-building.php');
require_once(QVA_ADMIN_MD . '/update/class.update.php');


if ( ! isset( $content_width ) ) $content_width = 900;
// add_action('get_header', 'enable_threaded_comments'); // Enable Threaded Comments
// add_action('widgets_init', 'my_remove_recent_comments_style'); // Remove inline Recent Comment Styles 
add_theme_support( 'html5', array( 'search-form' ) );


// add_filter('show_admin_bar', 'remove_admin_bar'); // Remove Admin bar


// Threaded Comments
function enable_threaded_comments()
{
    if (!is_admin()) {
        if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
            wp_enqueue_script('comment-reply');
        }
    }
}

// Remove wp_head() injected Recent Comment styles
function my_remove_recent_comments_style()
{
    global $wp_widget_factory;
    remove_action('wp_head', array(
        $wp_widget_factory->widgets['WP_Widget_Recent_Comments'],
        'recent_comments_style'
    ));
}

// Remove Admin bar
function remove_admin_bar()
{
    return false;
}

if (function_exists('add_theme_support'))
{   
    // Add Menu Support
    add_theme_support('menus');

    // Add Thumbnail Theme Support
    add_theme_support('post-thumbnails');
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'menus' );
    add_image_size( 'qva-blog', 650, 365, true);
    add_image_size( 'qva-nosidebar', 880, 365, true);
    add_image_size( 'qva-porfolio', 335, 335 );
    // Enables post and comment RSS feed links to head
    add_theme_support('automatic-feed-links');

    load_theme_textdomain('languages', get_template_directory() . '/languages');
}

// add_filter('post_row_actions', 'remove_row_actions', 10, 1);

function remove_row_actions($actions)
{
    if (get_post_type() == 'qva_ourteam')
    {
        unset( $actions['view'] );
        return $actions;
    }
}


// Pagination
function qva_pagination() 
{

    if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
        return;
    }

    $pattern = '#(www\.|https?:\/\/){1}[a-zA-Z0-9]{2,254}\.[a-zA-Z0-9]{2,4}[a-zA-Z0-9.?&=_/]*#i';

    $big = 999999999; // need an unlikely integer
    $pager_links = paginate_links( array(
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $GLOBALS['wp_query']->max_num_pages,
        'prev_text'    => __('Prev', QVA_LANG),
        'next_text'    => __('Next', QVA_LANG),
        'type'         => 'array',
    ) );
    // var_dump($pager_links);
    $count_links = count($pager_links);
   
    if ($count_links > 0) {
    echo '<div class="blog-pagination">';
        echo '<ul class="rs clearfix">';
            $first_link = $pager_links[0];
            $last_link = $first_link;

            echo  $first_link ;
            for ($i=1; $i<$count_links; $i++) {
                $pager_link =  $pager_links[$i];
                if (!qva_string_contains($pager_link, 'current'))
                    echo  '<li>' . $pager_link . '</li>';
                else 
                    echo '<li>' . $pager_link . '</li>';
                $last_link = '<li>' . $pager_link . '</li>';
            }
        echo '</ul>';
    echo '</div>';
        
    }
}

function qva_string_contains($haystack, $needle) 
{
    if (strpos($haystack, $needle) !== FALSE)
        return true;
    else
        return false;
}


if ( ! function_exists( 'qva_comment' ) ) :

function qva_comment( $comment, $args, $depth ) {
    $GLOBALS['comment'] = $comment;
    switch ( $comment->comment_type ) :
        case 'pingback' :
        case 'trackback' :
        // Display trackbacks differently than normal comments.
    ?>
    <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
        <p><?php _e( 'Pingback:', QVA_LANG ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', QVA_LANG ), '<span class="edit-link">', '</span>' ); ?></p>
    <?php
            break;
        default :
        // Proceed with normal comments.
        global $post;
    ?>
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
        <article id="comment-<?php comment_ID(); ?>" class="comment">
            <header class="comment-meta comment-author vcard">
                <?php
                    echo get_avatar( $comment, 44 );
                    printf( '<cite><b class="fn">%1$s</b> %2$s</cite>',
                        get_comment_author_link(),
                        // If current post author is also comment author, make it known visually.
                        ( $comment->user_id === $post->post_author ) ? '<span>' . __( 'Post author', QVA_LANG ) . '</span>' : ''
                    );
                    printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
                        esc_url( get_comment_link( $comment->comment_ID ) ),
                        get_comment_time( 'c' ),
                        /* translators: 1: date, 2: time */
                        sprintf( __( '%1$s at %2$s', QVA_LANG ), get_comment_date(), get_comment_time() )
                    );
                ?>
            </header><!-- .comment-meta -->

            <?php if ( '0' == $comment->comment_approved ) : ?>
                <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', QVA_LANG ); ?></p>
            <?php endif; ?>

            <section class="comment-content comment">
                <?php comment_text(); ?>
                <?php edit_comment_link( __( 'Edit', QVA_LANG ), '<p class="edit-link">', '</p>' ); ?>
            </section><!-- .comment-content -->

            <div class="reply">
                <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', QVA_LANG ), 'after' => ' <span>&darr;</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
            </div><!-- .reply -->
        </article><!-- #comment-## -->
    <?php
        break;
    endswitch; // end comment_type check
}
endif;

function qva_outputVideoOrImageFixedHtml($type="video", $link, $args = array())
{   

    if (empty($link)) 
    {
        if ( $type == 'video' )
        {
            wp_die('Please enter a youtube link');
        }else{
            wp_die('Opp! You does\'t have not image yet ;(');
        }
    }
    ?>
    
    <?php if ( !empty($args) ) : ?>
    <div class="bannerText container" style="position:absolute; z-index:99;">
        <?php  
            $title          = isset($args['title']) && !empty($args['title']) ? stripslashes($args['title']) : "";
            $span           = isset($args['span']) && !empty($args['span']) ? stripslashes($args['span']) : "";
            $description    = isset($args['description']) && !empty($args['description']) ? stripslashes($args['description']) : "";
            $linkTo         = isset($args['link']) && !empty($args['link']) ? stripslashes($args['link']) : "";
            $linkTitle      = isset($args['link_title']) && !empty($args['link_title']) ? stripslashes($args['link_title']) : "";

            switch ($args['style_span']) 
            {
                case 'blue':
                    $spanColor = '#29C5FF';
                    break;
                case 'red':
                    $spanColor = '#FF5E56';
                    break;    
                case 'green':
                    $spanColor = '#3BC492';
                    break;
                case 'orange':
                    $spanColor = '#FF5400';
                    break;
                case 'purple':
                    $spanColor = '#B061CF';
                    break;
                default:
                    $spanColor = '#FFE400';
                    break;
            }

            if ( !empty($title) && !empty($span) )
            {
                $createTitle = "<h1>".$title."<span>".$span."</span></h1>";
            }elseif(!empty($title) && empty($span)){
                $createTitle = "<h1>".$title . "</h1>";
            }elseif (empty($title) && !empty($span)) {
                $createTitle = "<span style='color: ".$spanColor." !important;'>".$span . "</span>";
            }else{
                $createTitle = "";
            }

            echo $createTitle;
            if (!empty($description)) 
                echo '<p>' . $description  . '</p>';

            if ( !empty($linkTo) )
                echo '<a href="'.$linkTo.'" class="mbnt">'.  $linkTitle .'</a>';
        ?>
    </div>
    <?php endif; ?>
   
        <?php if ($type == "video") : ?>
        <div class="viDeo" style="width: 100%; height: 100%;">
            <div id="video-element" class="viDeo" style="width: 100%; min-height: 100%; background: #000;">
                <a id="video" class="player" data-property="{videoURL:'<?php echo esc_url($link) ?>',containment:'#video-element', showControls:false, autoPlay:true, loop:true, mute:true, startAt:0, opacity:1, addRaster:false, quality:'default'}">My video</a> <!--BsekcY04xvQ-->
            </div>
        </div>
        <?php 
            else :
        ?>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="height:100%; z-index:90; position:relative;">
            <img src="<?php echo wp_get_attachment_url($link) ?>" alt="<?php echo get_post_meta( $link, '_wp_attachment_image_alt', true ); ?>" class="slieback" >
         </div>
        <?php         
            endif;
        ?>
    
    <?php 
}

/*
 * Shortcode gallery
 */




function woCreateMenu()
{
    $aOptions  = qvaCore::$qvaOptions;

    $aKey = array("header"=>"Home", "ourservices"=>"Services", "aboutus"=>"About Us", "ourteam"=>"Our Team", "ourwork"=>"Our Work", "ourclients"=>"Our Client", "contact"=>"Contact");

    $menu = "";

    foreach ($aKey as $k => $v) :
        if ( isset($aOptions[$k]['enable']) && !empty($aOptions[$k]['enable']) && $k == 'header' )
        {
            $menu .= '<li class="menuItem active"><a href="#wrapper">'.$v.'</a></li>';
        }elseif (isset($aOptions[$k]['enable']) && !empty($aOptions[$k]['enable']) ) {
            $menu .= '<li class="menuItem"><a href="#'.$k.'">'.$v.'</a></li>';
        }  
    endforeach;

    echo $menu;

}


add_action('wp_head', 'qva_custom_some_for_css');

function qva_custom_some_for_css()
{
    ?>
    <script type="text/javascript">
        var woHomeUrl = "<?php echo site_url(); ?>"
    </script>
    <?php 

    if ( isset(qvaCore::$qvaOptions['header']['enable']) && !empty(qvaCore::$qvaOptions['header']['enable']) ) :

        $headerType = isset(qvaCore::$qvaOptions['header']['type']) ? qvaCore::$qvaOptions['header']['type'] : '';
        if ($headerType != '') :


        if ($headerType != 'slider')  :   
            $pattern = isset(qvaCore::$qvaOptions['header']['pattern']) ? qvaCore::$qvaOptions['header']['pattern'] : 'pattern_1';
            $overlay = isset(qvaCore::$qvaOptions['header']['overlay']) ? qvaCore::$qvaOptions['header']['overlay'] : 'transparent';
        else :
            $slideId = isset(qvaCore::$qvaOptions['header']['tunna_slider']) ? qvaCore::$qvaOptions['header']['tunna_slider'] : '';

            if (!empty($slideId)) :
            $aData = get_post_meta($slideId, "tunna_slider", true);
            $overlay = isset($aData['overlay']) && !empty($aData['overlay']) ? $aData['overlay'] : 'transparent';
            $pattern = isset($aData['pattern']) && !empty($aData['pattern']) ? $aData['pattern'] : 'transparent';
            else:
                ?>
                <script type="text/javascript">
                    alert("Please create a slider");
                </script>
                <?php 
            endif;
        endif;

    endif;
    
    $patternsDir = get_template_directory_uri() . '/assets/images/patterns/';

    $output ="";
    $output .= '<style type="text/css">';
    $output .= '.banner:after {';

    switch ($pattern) {
        case 'pattern_1':
            $output .= 'url("'.$patternsDir.'/pat1.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important';
            break;
        case 'pattern_2':
            $output .= 'url("'.$patternsDir.'/pat2.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important';
            break;
        case 'pattern_3':
            $output .= 'url("'.$patternsDir.'/pat3.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important';
            break;
        case 'pattern_4':
            $output .= 'url("'.$patternsDir.'/pat4.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important';
            break;
        case 'pattern_5':
            $output .= 'url("'.$patternsDir.'/pat5.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important';
            break;
        
        default:
            $output .= 'url("'.$patternsDir.'/pat6.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important';
            break;
    }

    $output .= 'content: "";';
    $output .= '}';

    $output .= '.banner{ background-color: ';
    switch ($overlay) {
        case 'red':
            $output .= '#D20000;';
            break;
        case 'green':
            $output .= '#7AA200';
            break;
        case 'blue':
            $output .= '#005CAE';
            break;
        case 'orange':
            $output .= '#FF5400';
            break;
        case 'purple':
            $output .= '#B061CF';
            break;
        default:
            $output .= '#000000';
            break;
    }
    $output .= ' !important}';
    
    $output .= '</style>';

    echo $output;

    endif;

    $bgTextQuotes = isset(qvaCore::$qvaOptions['ourservices']['parallax']) && !empty(qvaCore::$qvaOptions['ourservices']['parallax']) ? qvaCore::$qvaOptions['ourservices']['parallax'] : '';
    $bgAboutus = isset(qvaCore::$qvaOptions['aboutus']['parallax']) && !empty(qvaCore::$qvaOptions['aboutus']['parallax']) ? qvaCore::$qvaOptions['aboutus']['parallax'] : '';
    $bgOurClients = isset(qvaCore::$qvaOptions['ourclients']['parallax']) && !empty(qvaCore::$qvaOptions['ourclients']['parallax']) ? qvaCore::$qvaOptions['ourclients']['parallax'] : '';
    $bgContact = isset(qvaCore::$qvaOptions['contact']['parallax']) && !empty(qvaCore::$qvaOptions['contact']['parallax']) ? qvaCore::$qvaOptions['contact']['parallax'] : '';


    if ( !empty($bgTextQuotes)|| !empty($bgAboutus) || !empty($bgOurClients) || !empty($bgContact) ) :
        echo '<style type="text/css">';
            if (!empty($bgTextQuotes))
                echo '.textQu{background:#101010 url('.$bgTextQuotes.') repeat 0 0 fixed !important;}';
            if (!empty($bgAboutus))
                echo '.factabout{background:#101010 url('.$bgAboutus.') repeat 0 0 fixed !important;}';
            if (!empty($bgOurClients))
                echo '.wework{background:#101010 url('.$bgOurClients.') repeat 0 0 fixed !important;}';
            if (!empty($bgContact))
                echo '.contactInfo{background:#101010 url('.$bgContact.') repeat 0 0 fixed !important;}';
        echo '</style>';
    endif;
}



// create slider 
function qva_create_slider($aIdImages, $fullsize=false)
{
    $size = !$fullsize ? 'qva-blog' : 'qva-nosidebar';
    $parse = explode(",", $aIdImages);

    echo '<ul class="bxslider featured-post-slider">';
        foreach ($parse as $v):
            echo '<li>'.wp_get_attachment_image($v, $size).'</li>';
        endforeach; 
    echo '</ul>';
}

// create youtube
function qva_embbed_video($link)
{
    $getId  = "";
    if ( preg_match("#youtube#", $link) )
    {
        $parse = strpos($link, '=');
        $getId = substr($link, $parse);
        $getId = str_replace("=", "", $getId);
        $type  = "youtube";
    }elseif (preg_match("#vimeo#", $link)) {
        $getId = str_replace("http://vimeo.com/", "", $link);
        $type  = "vimeo";
    }

    if (empty($getId)) return;
    


    ?>
    <div class="vendor">
      <figure>
        <?php if ($type == "youtube") : ?>
        <iframe width="425" height="225" src="http://www.youtube.com/embed/<?php echo $getId ?>" frameborder="0" allowfullscreen></iframe>
        <?php else : ?>
        <iframe src="http://player.vimeo.com/video/<?php echo $getId ?>?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
        <?php endif; ?>
      </figure>
    </div>
    <?php
}

// getimage
function qva_get_image($id, $fullsize=false)
{
    $size = !$fullsize ? 'qva-blog' : 'qva-nosidebar';
    echo wp_get_attachment_image($id, $size);
}

// view type
function qva_view_type($id)
{
    $fullsize=false;
    $sidebarType = isset(qvaCore::$qvaOptions['design']['choosidebar']) && !empty(qvaCore::$qvaOptions['design']['choosidebar']) ? qvaCore::$qvaOptions['design']['choosidebar'] : 'r-sidebar';

    if ($sidebarType == 'no-sidebar')
    {
        $fullsize = true;
    }

    $metaData    = get_post_meta($id, 'custompost', true);
    // var_dump($metaData);echo $id;
    
    if (isset($metaData['headertype']))
    {
       
        switch ($metaData['headertype']) {
            case 'imageslideshow':
                $getId = isset($metaData['slideshow']) ? $metaData['slideshow'] : '';
                if (!empty($getId))
                {
                    qva_create_slider($getId, $fullsize);
                }
                break;
            
            case 'youtube':
                $getLink = isset($metaData['videolink']) ? $metaData['videolink'] : '';
                if (!empty($getLink))
                    qva_embbed_video($getLink);
                break;
            case 'imagestatic':
                $getId = isset($metaData['staticimg']) ? $metaData['staticimg'] : '';
                if (!empty($getId))
                    qva_get_image($getId, $fullsize);
                break;
        }
    }
}

function qva_create_nav_filters()
{
    $aNavFilter = get_terms("qva_ourwork_cat");

    if ( !empty($aNavFilter)  && !is_wp_error($aNavFilter) )
    {
        ?>
        <li><a href="#" data-filter="*" class="current">All</a></li>
        <?php 
        foreach ($aNavFilter as $term) 
        {
            $filter = '.qva_'.$term->slug.$term->term_id;
            ?>
            <li><a href="#" data-filter="<?php echo $filter ?>"><?php echo $term->name; ?></a></li>
            <?php 
        }
    }else{
        echo "Opp! You haven't created any post yet";
    }

}

function qva_show_gallery()
{
    $args = array("post_type"=>"qva_ourwork", "posts_per_page"=>-1, "post_status"=>"publish");
    $aGallies = get_posts($args);

    $output = "";
    if (!empty($aGallies) && !is_wp_error($aGallies))
    {
        
        foreach ($aGallies as $gallery) : setup_postdata($gallery);
            $metaData = get_post_meta($gallery->ID, "qva_ourwork", true);
            // var_dump($metaData);
            $projectTitle = get_the_title($gallery->ID);
            $metaData = isset($metaData['ourwork']) ? $metaData['ourwork'] : null;
            // var_dump($metaData);
            if (empty($metaData)) return;

            $link = isset($metaData['link']) ? $metaData['link'] : '';
            $imageId = isset($metaData['image_id']) ? $metaData['image_id'] : '';
            // $getTerms = get_term_by('id', $gallery->ID, 'wo_ourwork_cat');
            $classFilter = "";
            $getTerms = wp_get_post_terms($gallery->ID, 'qva_ourwork_cat');
          
            if (!empty($getTerms) && !is_wp_error($getTerms))
            {
                
                foreach ($getTerms as $term)
                {
                    $classFilter .= 'qva_'.$term->slug.$term->term_id  . ' ';
                }
            } 
      
            if (!empty($imageId))
            {
                $parse = explode(",", $imageId);
                $numLoop=0;
                foreach ($parse as $k => $imgId) :

                if ($numLoop == 0)
                {
                    $thumbnail = wp_get_attachment_image($imgId, "qva-porfolio", array('alt'   => trim(strip_tags( get_post_meta($imgId, '_wp_attachment_image_alt', true) ))));
                    $class = "";
                }else{
                    $thumbnail = wp_get_attachment_image($imgId, 'full', array('alt'   => trim(strip_tags( get_post_meta($imgId, '_wp_attachment_image_alt', true) ))));
                    $class = " hidden";
                }
                $numLoop ++;

                $imageUrl = wp_get_attachment_url($imgId);

                

                $bLinkTo = !empty($link) ? '<a href="'.$link.'" title="'.$projectTitle.'" target="_blank" class="linKed"><i class="fa fa-link fa-2x"></i></a>' : '';

                $output .= "<li class='".$classFilter. $class ." col-xs-6 col-sm-4 col-md-3 col-lg-3'>";
                $output .=      "<div class='lightCon'>";
                $output .=          "<span class='hoverBox'>";
                $output .=              "<span class='smallIcon'>";
                $output .=                  '<a  href="'.$imageUrl.'" title="'.$projectTitle.'" class="zoom lb lb_warsaw1">';
                $output .=                     '<i class="fa fa-search fa-2x"></i>';
                $output .=                 '</a>';
                $output .=                  $bLinkTo;
                $output .=              '</span>';
                $output .=            '</span>';
                $output .=          $thumbnail;
                $output .=      '</div>';
                $output .= "</li>";

                endforeach;
            }
            
        endforeach;
    }
    echo $output;
}

function qva_shortcode_gallery($gallery, $classFilter="")
{
    if ( empty($gallery) )
        return;

    $getIds = $gallery['ids'];

    if ( empty($getIds) )
        return;

    $parseIds = explode(",", $getIds);

    $output = "";

    foreach ($parseIds as $id) :

        $image  = wp_get_attachment_image($id, 'qva_ourwork', array('alt'   => trim(strip_tags( get_post_meta($id, '_wp_attachment_image_alt', true) ))));
        $link   = wp_get_attachment_url($id);
        $linkTo = get_post_meta($id, 'qva_insert_link', true);

        $bLinkTo = !empty($linkTo) ? '<a href="'.$linkTo.'" title="Project Link" target="_blank" class="linKed"><i class="fa fa-link fa-2x"></i></a>' : '';

        $output .= "<li class='".$classFilter." col-xs-6 col-sm-4 col-md-3 col-lg-3'>";
        $output .=      "<div class='lightCon'>";
        $output .=          "<span class='hoverBox'>";
        $output .=              "<span class='smallIcon'>";
        $output .=                  '<a rel="lightbox-demo" href="'.$link.'" title="Project Title1" class="zoom lb lb_warsaw1">';
        $output .=                     '<i class="fa fa-search fa-2x"></i>';
        $output .=                 '</a>';
        $output .=                  $bLinkTo;
        $output .=              '</span>';
        $output .=            '</span>';
        $output .=          $image;
        $output .=      '</div>';
        $output .= "</li>";
    endforeach;

    echo $output;
}

function qva_get_meta_data()
{
    global $post;
    ?>
    <div class="post-meta">
            By
            <a href="<?php the_author_link(); ?>"><?php echo the_author(); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;
            on <?php the_time('M j, Y') ?>&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="<?php the_permalink() ?>"><?php  comments_number('No Commment', '1 Comment', '% Comments') ?></a> &nbsp;&nbsp;&nbsp;&nbsp;
            <?php the_category(" &bull; "); ?>
    </div>
    <?php 
}



function qva_excerpt_length($length)
{
    return 100;
}

add_filter('excerpt_length', 'qva_excerpt_length');


//wp_get_http_headers(site_url(), true);

require_once dirname(__FILE__) . '/admin/automatic-installation-plugins.php';

add_filter( 'wp_link_pages_args', 'theme_link_pages_args' );

function theme_link_pages_args( $args ){
    $args = array(
        'before'           => '<div class="link-pages">Page ',
        'after'            => '</div>',
        'link_before'      => '',
        'link_after'       => '',
        'next_or_number'   => 'number',
        'separator'        => '<span>',
        'nextpagelink'     => 'Next Page',
        'previouspagelink' => 'Previous Page',
        'pagelink'         => '%',
        'echo'             => 1
    );
    return $args;
}

add_filter('body_class','qva_class_names');

function qva_class_names($classes)
{
    if( (  !is_404() && !qva_is_static_page() ) ) $classes[] =  "blog";
    return $classes; 
}

function qva_is_static_page()
{
    if ( 'page' == get_option( 'show_on_front' )  )
    {

        if ( is_front_page()  )
        {
            return true;
        }
    }
    return false;
}


add_filter( 'previous_post_link', 'qva_filter_prev_post', 10, 2 );
add_filter( 'next_post_link', 'qva_filter_next_post', 10, 2 );
function qva_filter_next_post( $format, $link )
{
    $previous = 'previous_post_link' === current_filter();

    // Get the next/previous post object
    $post = get_adjacent_post(
         false
        ,''
        ,false
    );

    if ( empty($post) ) 
    {
        return null;    
    }

    $title = get_the_title( $post->ID );

    // Copypasta from cores `get_adjacent_post_link()` fn
    ('' === $title && $title == $previous ) ? sprintf( __( 'Previous Post: %s', QVA_LANG ), $title ) : sprintf( __( 'Next Post: %s', QVA_LANG ), $title );

    $format = str_replace(
         'rel="'
        ,sprintf(
             'title="%s" rel="'
            ,$title
         )
        ,$format
    );

    return "<span class='some classes'>{$format}</span>";
}

function qva_filter_prev_post( $format, $link )
{
    $previous = 'previous_post_link' === current_filter();

    // Get the next/previous post object
    $post = get_adjacent_post(
         false
        ,''
        ,true
    );

    if ( empty($post) ) 
    {
        return null;    
    }

    $title = get_the_title( $post->ID );

    // Copypasta from cores `get_adjacent_post_link()` fn
    ('' === $title && $title == $previous )
            ? sprintf( __( 'Previous Post: %s', QVA_LANG ), $title )
            : sprintf( __( 'Next Post: %s', QVA_LANG ), $title );

    $format = str_replace(
         'rel="'
        ,sprintf(
             'title="%s" rel="'
            ,$title
         )
        ,$format
    );

    return "<span class='some classes'>{$format}</span>";
}
